package pacman;

import static org.junit.Assert.assertTrue;

import java.io.IOException;

import maze.Direction;
import maze.Location;
import maze.Maze;

import org.junit.Test;

import sensors.realSensors.RealInfraredSensor;
import sensors.realSensors.RealLightSensor;
import sensors.realSensors.RealUltrasonicSensor;
import simulation.ColorMap;
import simulation.Simulator;
import behaviour.Explorer;

import communication.Communicator;

public class GhostTest {
	
//	@Test
//	public void test() {
//		Ghost ghost= new Ghost(new Location(0,0), 0, null, null, null, null, null);
//		Direction[] directions= new Direction[4];
//		directions[0]=Direction.NORTH;
//		directions[1]=Direction.EAST;
//		directions[2]=Direction.SOUTH;
//		directions[3]=Direction.WEST;
//		ghost.shiftArray(directions, 3);
//		System.out.println(directions[0]);
//		assertEquals(directions[0]==Direction.EAST);
//	}
	@Test
	public void testTravelToNextSector() throws IOException{
		char[][] walls = {
				{0,0,0,0,0,1,0,1,0},
				{0,0,0,0,1,2,1,2,1},
				{0,1,0,1,1,2,2,2,1},
				{1,2,2,1,2,1,1,2,1},
				{1,2,2,2,2,1,1,1,1},
				{1,2,1,2,1,0,0,0,0},
				{1,1,2,1,1,0,0,0,0}};
		
		Maze maze = new Maze(walls);
		ColorMap colorMap = new ColorMap();
		colorMap.setupMap(maze, maze.getSize(), maze.getSize());
		Simulator simulator = new Simulator(maze, colorMap);
		Ghost ghost;
		ghost = new Ghost(new Location(0,0), 0, "h");
		ghost.setInfraredSensor(new RealInfraredSensor(ghost));
		ghost.setLightSensor(new RealLightSensor(ghost));
		ghost.setUltrasonicSensor(new RealUltrasonicSensor(ghost));
		ghost.xOffsetSensor = -5;
		ghost.yOffsetSensor = 3;

		Communicator communicator = new Communicator();		
		ghost.setCommunicator(communicator);
		Explorer explorer = new Explorer(ghost.getMaze());
		ghost.strategy = explorer;
		simulator.addGhost(ghost, new Location(20, 20), 90);
		ghost.travelToNextSector(true);
		//			ghost.updateStrategy();

	}

}
